package com.klz.iblog.service.serviceImpl;

import com.klz.iblog.dao.CommentsMapper;
import com.klz.iblog.pojo.Comments;
import com.klz.iblog.service.CommentsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CommentsServiceImpl implements CommentsService {

    @Autowired(required = false)
    private CommentsMapper commentsMapper;

    /**
     * 查询所有博客的评论量
     * @return
     */
    @Override
    public Integer selectAllCommentsCounts() {
        return commentsMapper.selectAllCommentsCounts();
    }

    /**
     * 查询该评论的所有回复
     * @param commentsId
     * @return
     */
    @Override
    public List<Comments> selectCommentsAllReplys(Integer commentsId) {
        return commentsMapper.selectCommentsAllReplys(commentsId);
    }

    /**
     * 查询该评论的所有回复总数
     * @param commentsId
     * @return
     */
    @Override
    public Integer selectCommentsAllReplysCount(Integer commentsId) {
        return commentsMapper.selectCommentsAllReplysCount(commentsId);
    }
}
